# 使用 debian:bullseye-slim 作为基础镜像
FROM debian:latest

# 设置环境变量，避免交互式安装时的提示
ENV DEBIAN_FRONTEND=noninteractive

# 安装基础工具
RUN apt-get update && apt-get install -y \
    curl \
    gnupg \
    lsb-release \
    wget \
    && rm -rf /var/lib/apt/lists/*

# 添加 NVIDIA 的 GPG 密钥
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DDCAE044F796ECB0

# 添加 NVIDIA 包仓库
RUN curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
    && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
    tee /etc/apt/sources.list.d/nvidia-container-toolkit.list

# 安装 NVIDIA Container Toolkit
RUN apt-get update && apt-get install -y \
    nvidia-container-toolkit \
    && rm -rf /var/lib/apt/lists/*

# 安装 Ollama 的依赖
# RUN apt-get update && apt-get install -y \
#     wget \
#     && rm -rf /var/lib/apt/lists/*

# 下载并安装 Ollama
RUN curl -fsSL https://ollama.ai/install.sh | sh

# 设置容器启动命令
CMD ["ollama", "serve"]